home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_perl.idb / usr / freeware / catman / p_man / cat3 / Tie::Scalar.Z / Tie::Scalar
Encoding:
Text File  |  1998-10-28  |  3.8 KB  |  133 lines

  1.  
  2.  
  3.  
  4.      TTTTiiiieeee::::::::SSSSccccaaaallllaaaarrrr((((3333))))  22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))    TTTTiiiieeee::::::::SSSSccccaaaallllaaaarrrr((((3333))))
  5.  
  6.  
  7.  
  8.      NNNNAAAAMMMMEEEE
  9.       Tie::Scalar, Tie::StdScalar -    base class definitions for
  10.       tied scalars
  11.  
  12.      SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  13.           package NewScalar;
  14.           require Tie::Scalar;
  15.  
  16.           @ISA = (Tie::Scalar);
  17.  
  18.           sub FETCH    { ... }          # Provide a needed method
  19.           sub TIESCALAR { ... }      # Overrides inherited    method
  20.  
  21.  
  22.           package NewStdScalar;
  23.           require Tie::Scalar;
  24.  
  25.           @ISA = (Tie::StdScalar);
  26.  
  27.           #    All methods provided by    default, so define only    what needs be overridden
  28.           sub FETCH    { ... }
  29.  
  30.  
  31.           package main;
  32.  
  33.           tie $new_scalar, 'NewScalar';
  34.           tie $new_std_scalar, 'NewStdScalar';
  35.  
  36.  
  37.      DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  38.       This module provides some skeletal methods for scalar-tying
  39.       classes. See the _p_e_r_l_t_i_e manpage for a list of the functions
  40.       required in tying a scalar to    a package. The basic
  41.       TTTTiiiieeee::::::::SSSSccccaaaallllaaaarrrr package provides a new method, as    well as
  42.       methods TIESCALAR, FETCH and STORE. The TTTTiiiieeee::::::::SSSSttttddddSSSSccccaaaallllaaaarrrr
  43.       package provides all the methods specified in     the _p_e_r_l_t_i_e
  44.       manpage. It inherits from TTTTiiiieeee::::::::SSSSccccaaaallllaaaarrrr    and causes scalars
  45.       tied to it to    behave exactly like the    built-in scalars,
  46.       allowing for selective overloading of    methods. The new
  47.       method is provided as    a means    of grandfathering, for classes
  48.       that forget to provide their own TIESCALAR method.
  49.  
  50.       For developers wishing to write their    own tied-scalar
  51.       classes, the methods are summarized below. The the _p_e_r_l_t_i_e
  52.       manpage section not only documents these, but    has sample
  53.       code as well:
  54.  
  55.       TIESCALAR classname, LIST
  56.            The method invoked by the command tie $scalar,
  57.            classname. Associates a new scalar instance with    the
  58.            specified class.    LIST would represent additional
  59.            arguments (along    the lines of the _A_n_y_D_B_M__F_i_l_e manpage
  60.  
  61.  
  62.  
  63.      Page 1                        (printed 10/23/98)
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.      TTTTiiiieeee::::::::SSSSccccaaaallllaaaarrrr((((3333))))  22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))    TTTTiiiieeee::::::::SSSSccccaaaallllaaaarrrr((((3333))))
  71.  
  72.  
  73.  
  74.            and compatriots)    needed to complete the association.
  75.  
  76.       FETCH    this
  77.            Retrieve    the value of the tied scalar referenced    by
  78.            _t_h_i_s.
  79.  
  80.       STORE    this, value
  81.            Store data _v_a_l_u_e    in the tied scalar referenced by _t_h_i_s.
  82.  
  83.       DESTROY this
  84.            Free the    storage    associated with    the tied scalar
  85.            referenced by _t_h_i_s.  This is rarely needed, as Perl
  86.            manages its memory quite    well. But the option exists,
  87.            should a    class wish to perform specific actions upon
  88.            the destruction of an instance.
  89.  
  90.      MMMMOOOORRRREEEE IIIINNNNFFFFOOOORRRRMMMMAAAATTTTIIIIOOOONNNN
  91.       The the _p_e_r_l_t_i_e manpage section uses a good example of tying
  92.       scalars by associating process IDs with priority.
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.      Page 2                        (printed 10/23/98)
  130.  
  131.  
  132.  
  133.